@extends('layouts.app')

@section('content')

    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                动画管理
                <small>修改动画</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 管理后台</a></li>
                <li><a href="#">动画管理</a></li>
                <li class="active">修改动画</li>
            </ol>
        </section>

        <section class="content">
            <div class="row">
                <div class="col-xs-12">
                    <div class="box">
                        <div class="box-header">
                            <h3 class="box-title">修改动画</h3>
                        </div>
                        <div class="box-body">
                            @if (session('status'))
                                <div class="alert alert-danger">
                                    {{ session('status') }}
                                </div>
                            @endif

                            <form class="form-horizontal" role="form" method="POST" action="{{ url('admin/animation/'.$model->id) }}">
                                {{ csrf_field() }}
                                <input type="hidden" name="_method" value="PUT" />

                                <div class="form-group{{ $errors->has('name') ? ' has-error' : '' }}">
                                    <label for="name" class="col-xs-4 control-label">动画名称</label>

                                    <div class="col-xs-6">
                                        <input id="name" type="text" class="form-control" name="name" value="{{ $model->name }}" autofocus>

                                        @if ($errors->has('name'))
                                            <span class="help-block"><strong>{{ $errors->first('name') }}</strong></span>
                                        @endif
                                    </div>
                                </div>

                                <div class="form-group{{ $errors->has('classname') ? ' has-error' : '' }}">
                                    <label for="classname" class="col-xs-4 control-label">css名称</label>

                                    <div class="col-xs-6">
                                        <input id="classname" type="text" class="form-control" name="classname" value="{{ $model->classname }}">

                                        @if ($errors->has('classname'))
                                            <span class="help-block"><strong>{{ $errors->first('classname') }}</strong></span>
                                        @endif
                                    </div>
                                </div>

                                <!-- 选择所属分类 -->
                                <div class="form-group{{ $errors->has('category_id') ? ' has-error' : '' }}">
                                    <label for="category_id" class="col-xs-4 control-label">动画分类</label>

                                    <div class="col-xs-6">
                                        <select id="category_id" class="form-control" name="category_id">
                                            @foreach ($categoryModels as $category)
                                                <option value="{{ $category->id }}" @if ($category->id == $model->category_id) selected="selected" @endif >{{ $category->name }}</option>
                                            @endforeach
                                        </select>

                                        @if ($errors->has('category_id'))
                                            <span class="help-block"><strong>{{ $errors->first('category_id') }}</strong></span>
                                        @endif
                                    </div>
                                </div>

                                <!-- css 文本内容 -->
                                <div class="form-group{{ $errors->has('content') ? ' has-error' : '' }}">
                                    <label for="content" class="col-xs-4 control-label">css文本</label>

                                    <div class="col-xs-6">
                                        <textarea id="content" class="form-control" name="content" rows="10" style="resize: vertical;">{{$model->content }}</textarea>

                                        @if ($errors->has('content'))
                                            <span class="help-block"><strong>{{ $errors->first('content') }}</strong></span>
                                        @endif
                                    </div>
                                </div>

                                <div class="form-group">
                                    <div class="col-md-8 col-md-offset-4">
                                        <button type="submit" class="btn btn-primary">修改</button>&nbsp;&nbsp;
                                        <a href="{{ url('admin/animation') }}" role="button" class="btn btn-info">返回</a>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>

@endsection

@section('javascript')

    <script src="{{ asset('/plugins/jQuery/jquery-2.2.3.min.js') }}"></script>
    <script src="{{ asset('/bootstrap/js/bootstrap.min.js') }}"></script>
    <script src="{{ asset('/js/app.min.js') }}"></script>

@endsection